using Sirenix.OdinInspector.Editor;
using UnityEditor;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [CustomEditor(typeof(EntityGenConfigAsset))]
    public class EntityGenConfigAssetEditor : OdinEditor
    {
        public override void OnInspectorGUI()
        {
            EntityGenConfigAsset scriptableObject = (EntityGenConfigAsset)target;
            if (GUILayout.Button("生成预制体"))
            {
                string path = string.Empty;
                switch (scriptableObject.genAnimatorType)
                {
                    case ArtModeGenType.LevelCharacter:
                    case ArtModeGenType.BattleCharacter:
                        path = "Assets/Res/04_ArtModel/Character/" + scriptableObject.name;
                        break;
                    case ArtModeGenType.LevelEntity:
                    case ArtModeGenType.BattleMonster:
                        path = "Assets/Res/04_ArtModel/Entity/" + scriptableObject.name;
                        break;
                    case ArtModeGenType.Live2D:
                        path = "Assets/Res/04_ArtModel/Live2D/" + scriptableObject.name;
                        break;
                    default:
                        break;
                }
                if (!string.IsNullOrEmpty(path) && AssetDatabase.IsValidFolder(path))
                {
                    ArtPrefabEditorMenu.GenPrefabByType(path, scriptableObject.genAnimatorType, false);
                }
            }
            base.OnInspectorGUI();
        }
    }
}